﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.Security;
using System.Web.UI.WebControls;

using ManageMoney.Web.AppCode;

namespace ManageMoney.Web.MasterPages.PaginaPublica
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Sesion.UsuarioMoney.RolId == null) this.ExitSystem();
        }

        protected void lkbCerrarSesion_Click(object sender, EventArgs e)
        {
            this.ExitSystem();
        }

        public void ExitSystem()
        {
            Session.RemoveAll();
            FormsAuthentication.SignOut();
            Response.Redirect("~/Login.aspx", true);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;

            ltrUsuario.Text = Sesion.UsuarioMoney.Nombre;
        }

    }
}